﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PowerMonitor
{
    public partial class ValueInput : Form
    {
        public List<string> strList = new List<string>();
        public ValueInput()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            strList.Clear();
            strList.AddRange(txtInput.Text.Trim().Split('\n'));
            StringBuilder strTemp = new StringBuilder();
            for (int i = 0; i < strList.Count; i++)
            {
                strTemp.Clear();
                strTemp.Append(strList[i]);
                strTemp.Replace("\r", null);
                strList[i] = strTemp.ToString();
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void ValueInput_Load(object sender, EventArgs e)
        {
            txtInput.Text = "";
            for (int i = 0; i < strList.Count; i++)
            {
                if (i != strList.Count - 1)
                {
                    txtInput.Text = txtInput.Text + strList[i] + "\r\n";
                }
                else
                {
                    txtInput.Text = txtInput.Text + strList[i];
                }
            }
        }

        private void btnSelectAll_Click(object sender, EventArgs e)
        {
            txtInput.SelectAll();
            txtInput.Select(0, txtInput.TextLength);
            txtInput.SelectionBackColor = Color.LightBlue;
        }

        private void btnDuplicate_Click(object sender, EventArgs e)
        {
            txtInput.Copy();

        }

        private void btnCut_Click(object sender, EventArgs e)
        {
            txtInput.Cut();
        }

        private void btnPaste_Click(object sender, EventArgs e)
        {
            txtInput.Paste();
        }

    }
}
